
<%@page import="models.Inlink"%>
<%@page import="controller.Utils"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="models.Domain"%>
<%@page import="com.googlecode.objectify.Query"%>
<%
Domain list = (Domain) request.getAttribute("list");
Inlink inlink = (Inlink) request.getAttribute("inlink");
String domain = (String) request.getAttribute("domain");
NumberFormat nf = NumberFormat.getInstance();
String url = "out-link/"+domain;

String title = "Cross link "+domain;
String description="In-link and out-link of "+domain+" on moodify";
String keyword = domain+","+"link,outlink,check link";
%>

<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
	<jsp:param name="description" value="<%=description %>" />
	<jsp:param name="keywords" value="<%=keyword %>" />
</jsp:include>

<div id="content">

	<div class='search'>
		<form action="/search-link" method="get">
			<input class="input" type="text" name="name"
				onclick="javascript:if(this.value=='Enter your domain...')this.value=''"
				value="Enter your domain...">
			<button type="submit">Check link</button>
		</form>
		<div class="clear"></div>
		<div class="adv728 clear_div">
			<jsp:include page="/adv/728x90.jsp"></jsp:include>
		</div>
	</div>

	<div>
		<jsp:include page="/adv/728x15.jsp"></jsp:include>
		<%
          	int count = 0;
          	if(list!=null&&list.getOutLink().size()>0)
			{
				count = list.getOutLink().size();
			}
          	%>	
        <h1><a href="/site/<%=domain %>"><%=domain %></a></h1>  	
		<p>These are out-links list of <i><%=domain %></i> ( <strong><%=count %></strong> ) View all out link <a href="/out-link/<%=domain %>"><%=domain %></a></p>
		<table class="exp">
		<%
		if(count>0)
		{
		%>
  		 	<%
  		 	int end = 0;
  		 	if(count>10)
  		 		end=10;
  		 	else
  		 		end=count;
			%>
			<tr>
   		 		<th align="left">Domain</th>
   		 		<th></th>
   		 	</tr>
			<%
			for(int i=0;i < end;i++)
			{
  		 	%>
  		 		<tr>
       		 		<td><% if(!Utils.fomatDomain(list.getOutLink().get(i)).trim().equals("")){ %><a href="/site/<%=Utils.fomatDomain(list.getOutLink().get(i)) %>"><%=Utils.fomatDomain(list.getOutLink().get(i)) %></a><% } %></td>
       		 		<td class="right"><% if(!Utils.fomatDomain(list.getOutLink().get(i)).trim().equals("")){ %>Check link <a href="/check-link/<%=Utils.fomatDomain(list.getOutLink().get(i)) %>"><%=Utils.fomatDomain(list.getOutLink().get(i)) %></a><% } %></td>
       		 	</tr>
  		 	<%
  		 	}
		}
  		 	%>
  		 </table>
			<br/>
	 	 <%
          	count = 0;
          	if(inlink!=null&&inlink.getInLink()!=null)
			{
          		count = inlink.getInLink().size();
			}
         %> 
         <p>These are in-links list of <i><%=domain %></i> ( <strong><%=count %></strong> ) View all in link <a href="/in-link/<%=domain %>"><%=domain %></a></p>
         <table class="exp">
         <%
         if(count>0)
         {
         %>
  		 	<%
			int end = 0;
  		 	if(count>10)
  		 		end=10;
  		 	else
  		 		end=count;
			%>
			<tr>
   		 		<th align="left">Domain</th>
   		 		<th></th>
   		 	</tr>
			<%
			for(int i=0;i < end;i++)
			{
  		 	%>
  		 		<tr>
       		 		<td><% if(!Utils.fomatDomain(inlink.getInLink().get(i)).trim().equals("")){ %><a href="/site/<%=Utils.fomatDomain(inlink.getInLink().get(i)) %>"><%=Utils.fomatDomain(inlink.getInLink().get(i)) %></a><% } %></td>
       		 		<td class="right"><% if(!Utils.fomatDomain(inlink.getInLink().get(i)).trim().equals("")){ %>Check link <a href="/check-link/<%=Utils.fomatDomain(inlink.getInLink().get(i)) %>"><%=Utils.fomatDomain(inlink.getInLink().get(i)) %></a><% } %></td>
       		 	</tr>
  		 	<%
  		 	}
         } else {
        	 if(list==null||(list!=null&&list.getOutLink().size()<=0))
        	 {
  		 	%>
  		 	<tr><td>
	 			Currently, we don't find in-links and out-links from your site. You can use tools is listed below to find more and more information about your site.
	 			<br/><br/>
	 			<a href="/network">Network tool</a> | <a href="/pagerank">Check pagerank</a> | <a href="/ip-lookup">Lookup ip</a>
	 		</td></tr>
  		 <%
        	 }
         }
  		 %>
  		 </table>
	</div>
</div>

<jsp:include page="layout/footer.jsp"></jsp:include>
